VERSION 1.0 CLASS
BEGIN
  MultiUse = -1  'True
  Persistable = 0  'NotPersistable
  DataBindingBehavior = 0  'vbNone
  DataSourceBehavior  = 0  'vbNone
  MTSTransactionMode  = 0  'NotAnMTSObject
END
Attribute VB_Name = "DataPoint"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = False
Option Explicit
'*************************************************************************
'  This source code is provided "as is" and as an unsupported sample of
'  a Microsoft Visual Basic application that incorporates the MapPoint 2002
'  object model and ActiveX control. It can only  be used in accordance with
'  the terms and conditions of the Microsoft MapPoint 2002 and
'  Microsoft Visual Basic End User License Agreements.
'*************************************************************************

Private m_sName As String
Private m_fLatitude As Double
Private m_fLongitude As Double
Private m_sSymbolData As String

Public Property Get Name() As String
    Name = m_sName
End Property

Public Property Let Name(sNewValue As String)
    m_sName = sNewValue
End Property

Public Property Get Latitude() As Double
    Latitude = m_fLatitude
End Property

Public Property Let Latitude(fNewValue As Double)
    m_fLatitude = fNewValue
End Property

Public Property Get Longitude() As Double
    Longitude = m_fLongitude
End Property

Public Property Let Longitude(fNewValue As Double)
    m_fLongitude = fNewValue
End Property

Public Property Get SymbolData() As String
    SymbolData = m_sSymbolData
End Property

Public Property Let SymbolData(sNewValue As String)
    m_sSymbolData = sNewValue
End Property

Public Function RenderShape(omMap As MapPoint.Map) As MapPoint.Location
'**********************************************************************************
    ' Date: 4/3/2001
    ' Abstract: Generates a PushPin object and a Location object for this DataPoint.
    ' Assumptions:
    ' Notes:
'**********************************************************************************

    Dim omLocation As MapPoint.Location
    Dim omPushPin As MapPoint.Pushpin
    
    On Error GoTo errorHandler
    
    'Create a Location object at this DataPoint's coordinates.
    Set omLocation = omMap.GetLocation(m_fLatitude, m_fLongitude)
    
    'Make sure we got a location.
    If Not omLocation Is Nothing Then
        
        'Create a PushPin at this location.
        Set omPushPin = omMap.AddPushpin(omLocation)
        
        'If we have a Name to apply, then apply it.
        If Len(m_sName) <> 0 Then
            omPushPin.Name = m_sName
        End If
        omPushPin.Symbol = 18   'Yellow circle
        
    End If
    
    'Return the Location object.
    Set RenderShape = omLocation
    
    Exit Function
errorHandler:
    MsgBox "Error in RenderShape" & vbCrLf _
         & "Error Number: " & Err.Number & vbCrLf _
         & "Error Description: " & Err.Description, vbExclamation, App.Title
End Function

